const $redis = require("../lib/redis") // 你的redis配置文件路径
module.exports = function (Data) {
   
    // 获取 
    Data.getMeta= async function (route="",params={}) {
        let meta = await $redis.get("ski:material:"+route);
        let def = {
            title:'SnoGoGo Community',
            description:'',
            keywords:'',
        };
        if(params.subtitle){
            def.title = params.subtitle+" - "+def.title;
        }
        if(meta==null){
            return def;
        }
         ////console.log("meta:",meta);
        let res = def;
        try {
             res = JSON.parse( meta)
        } catch (error) {
            ////console.log("error:,", res )
        }
		return res ;
	};

    Data.setMeta= async function (key,value) {
        let meta = await $redis.set("ski:"+key,value);
        console.log("meta:",value,meta)
		return meta ;
	};

   

}